home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / SBIN / SHADOWCO.{13 < prev    next >
Text File  |  1999-09-17  |  2KB  |  74 lines

  1. #!/bin/bash
  2. #
  3. #       'shadowconfig on' will turn shadow passwords on;
  4. #       'shadowconfig off' will turn shadow passwords off.
  5. #
  6. #       shadowconfig will print an error message and exit with
  7. #       a nonzero code if it finds anything awry.  If that happens,
  8. #       you should correct the error and run it again.
  9. #
  10. #       Turning shadow passwords on when they are already on, or
  11. #       off when they are already off, is harmless.
  12. #
  13. #       Be aware that account expiration dates are only supported
  14. #       by shadow passwords -- these dates will be lost when converting
  15. #       from shadow to non-shadow passwords.  If you need to save this
  16. #       information, back up your /etc/shadow before turning off
  17. #       shadow passwords.
  18. #       
  19.  
  20.  
  21. set -e
  22.  
  23. shadowon () {
  24. bash<<- EOF
  25.     set -e
  26.     pwck -q
  27.     grpck
  28.     pwconv
  29.     grpconv
  30.     cd /etc
  31.     chown root:root passwd group
  32.     chmod 644 passwd group
  33.     chown root:root shadow gshadow
  34.     chmod 640 shadow gshadow
  35. EOF
  36. }
  37.  
  38. shadowoff () {
  39. bash<<- EOF
  40.     set -e
  41.     pwck -q
  42.     grpck
  43.     pwunconv
  44.     grpunconv
  45.     cd /etc
  46.     # sometimes the passwd perms get munged
  47.     chown root:root passwd group
  48.     chmod 644 passwd group
  49. EOF
  50. }
  51.  
  52. case "$1" in
  53.     "on")
  54.     if shadowon ; then
  55.         echo Shadow passwords are now on.
  56.     else
  57.         echo Please correct the error and rerun \`$0 on\'
  58.         exit 1
  59.     fi
  60.     ;;
  61.     "off")
  62.     if shadowoff ; then
  63.         echo Shadow passwords are now off.
  64.     else
  65.         echo Please correct the error and rerun \`$0 off\'
  66.         exit 1
  67.     fi
  68.     ;;
  69.      *)
  70.     echo Usage: $0 on \| off
  71.     ;;
  72. esac
  73.  
  74.